package com.sl.au.config;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.sl.au.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledTask {
	@Autowired
	IndexService indexService;
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	private Integer count0 = 1;

	/*@Scheduled(cron = "0 1 0 * * ?")//每天0点过1分后执行任务*/
	@Scheduled(cron = "0 1 0 * * ?")//每天0点过1分后执行任务
	public void reportCurrentTime() throws InterruptedException {
		indexService.getAafterSale();
		System.out.println(String.format("---第%s次执行，当前时间为：%s", count0++, dateFormat.format(new Date())));
	}
}
